﻿ 

	
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="分公司">  
    <meta name="description" content="分公司">  
    <title>分公司管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>

</head>  
<body>  
    
      
    <table id="dg" title="分公司管理" style="width:1100px;height:250px"  
            url="/auth/systemBranchCompany/list.do"  
            toolbar="#toolbar" pagination="true"  
            rownumbers="true" fitColumns="true" loadMsg="正在查询,请稍候..." singleSelect="false">  

    </table>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">修改</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deletes()">删除</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="find()">查询</a>
    </div>  
    <!-- edit form窗体（开始） -->  
    <div id="dlg" class="easyui-dialog" style="width:600px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons">  
        <form id="fm" method="post" novalidate>  
        	  	  	 <input type="hidden" name="id" > 
	        		     <div class="fitem">  
                     <label style="width:100px">分公司代码<font color="red">*</font>:</label>                                            
                     <input name="branchNbr" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">分公司名<font color="red">*</font>:</label>                                            
                     <input name="name" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">地址:</label>                                            
                     <input name="address" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">电话:</label>                                            
                     <input name="tel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">传真:</label>                                            
                     <input name="fax" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">邮编:</label>                                            
                     <input name="postcode" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">开户银行:</label>                                            
                     <input name="bank" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">账户名,默认为分公司名:</label>                                            
                     <input name="accountName" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">银行帐号:</label>                                            
                     <input name="accountNo" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" data-options="formatter:formateDate"  class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" data-options="formatter:formateDate"  class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">上级公司id:</label>                       
                     <input name="parentId" class="easyui-numberbox">                       
                   </div>	        		     
        </form>  
    </div>  
    <!-- edit form窗体（结束） -->  
    <!-- query form窗体(开始) -->  
    <div id="dlg_query" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons-query">  
        <div class="ftitle">分公司</div>  
        <form id="fm_query" method="post" novalidate>  
            
              
	        		     <div class="fitem">  
                     <label style="width:100px">分公司代码:</label>                                            
                     <input name="branchNbr" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">分公司名:</label>                                            
                     <input name="name" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">地址:</label>                                            
                     <input name="address" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">电话:</label>                                            
                     <input name="tel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">传真:</label>                                            
                     <input name="fax" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">邮编:</label>                                            
                     <input name="postcode" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">开户银行:</label>                                            
                     <input name="bank" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">账户名,默认为分公司名:</label>                                            
                     <input name="accountName" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">银行帐号:</label>                                            
                     <input name="accountNo" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">上级公司id:</label>                       
                     <input name="parentId" class="easyui-numberbox">                       
                   </div>	        		     
              
              
        </form>  
    </div> 
    <!-- query form窗体(结束) -->  
    <div id="dlg-buttons">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">Save</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">关闭</a>  
    </div>  
    <div id="dlg-buttons-query">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="query()">确定</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_query').dialog('close')">关闭</a>  
    </div>  
    <script type="text/javascript">  
        var url;  
        function add(){         	 
            $('#dlg').dialog('open').dialog('setTitle','新增分公司');  
            $('#fm').form('clear');  
            url = '/auth/systemBranchCompany/save.do';  
        }  
        function edit(){  
            //var row = $('#dg').datagrid('getSelected');  
            var rows = $('#dg').datagrid('getSelections');
            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要修改的行','info');
            	 return;
            }
            if (!rows||rows.length>1){
            	 $.messager.alert('提示','不能选择多行','info');
            	 return;
            }
            if (rows){  
                $('#dlg').dialog('open').dialog('setTitle','修改分公司');  
                //$('#fm').form('load',rows[0]);  
                $('#fm').form('load','/auth/systemBranchCompany/get.do?id='+rows[0].id);  
                url = '/auth/systemBranchCompany/update.do';
            }  
        }  
        function save(){          	   
        	  if (!$('#fm').form('validate')) return; 
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');                      
                    if (result.success == true){  
                        $.messager.alert('信息',result.msg,'info');  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.alert('错误',result.msg,'error');
                    }  
                }  
            });  
        }  
        function deletes(){  
            var row = $('#dg').datagrid('getSelected');  
            
            var rows = $('#dg').datagrid('getSelections');  

            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要删除的行','info');
            	 return;
            }
            if (rows){  
                $.messager.confirm('重要提示','确定要删除?',function(r){  
                    if (r){  
                        $.post('/auth/systemBranchCompany/delete.do',{ids:getRecordArray(rows,'id').join(',')},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                 
                                $.messager.alert('错误',result.errorMsg,'error'); 
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        function find(){  
              
                $('#dlg_query').dialog('open').dialog('setTitle','查询');  
                
                url = '/auth/systemBranchCompany/list.do';  
              
        } 
        	
        function query(){  
                
                //var aa=$('#fm_query').formSerialize();
                var formdata=$('#fm_query').formToArray();
                //var dd= JSON.stringify(cc); 
                
                if (!$('#fm_query').form('validate')) return; 
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
               $('#dlg_query').dialog('close');
              
        }
        
        //生成grid的字段,需要字典的自动转换
        $('#dg').datagrid({
        	   columns:[[
        	   	
        	   	   {field:'branchNbr',title:'分公司代码', width:100}
        	   	   ,{field:'name',title:'分公司名', width:100}
        	   	   ,{field:'address',title:'地址', width:100}
        	   	   ,{field:'tel',title:'电话', width:100}
        	   	   ,{field:'fax',title:'传真', width:100}
        	   	   ,{field:'postcode',title:'邮编', width:100}
        	   	   ,{field:'bank',title:'开户银行', width:100}
        	   	   ,{field:'accountName',title:'账户名,默认为分公司名', width:100}
        	   	   ,{field:'accountNo',title:'银行帐号', width:100}
        	   	   ,{field:'creator',title:'创建人', width:100}
        	   	   ,{field:'createDt',title:'创建时间', width:100}
        	   	   ,{field:'modifier',title:'修改人', width:100}
        	   	   ,{field:'modifiedDt',title:'修改时间', width:100}
        	   	   ,{field:'parentId',title:'上级公司id', width:100}
        	   	
        	   	
        	   ]]
        	   ,onDblClickRow: function(rowIndex, rowData){
        	    	$('#dlg').dialog('open').dialog('setTitle','修改分公司');                  
                $('#fm').form('load','/auth/systemBranchCompany/get.do?id='+rowData.id);  
                url = '/auth/systemBranchCompany/update.do';        	    	
        	    }
        }); 
        //完成-生成grid的字段
        
        
        
    </script>  
     
     

     
     
     
</body>  
</html>